import java.io.Serializable;

/**
 * represents an inventory resource in a mule game
 * @author Sherman
 *
 */
public class InventoryResource implements Serializable {
	private String name; //name of the inventory resource
	private Object resource; //a mule or resource to go in inventory
	private int price; //price of the inventory resource
	private int amount; //how much of the inventory resource is available
	
	/**
	 * creates an inventory resource in a game of mule
	 * @param name the name of the resource
	 */
	public InventoryResource(String name){
		
		this.name = name;
		
		if (name.equalsIgnoreCase("muleEnergy")){
			this.resource = new Mule();
			price = 125;
			amount = 5;
		}
		
		else if (name.equalsIgnoreCase("muleFood")){
			this.resource = new Mule();
			price = 130;
			amount = 5;
		}
		
		else if (name.equalsIgnoreCase("muleSmithOre")){
			this.resource = new Mule();
			price = 150;
			amount = 5;
		}
		
		else{	
			this.resource = new Resource(name);
			
			if (name.equalsIgnoreCase("food")){
				price = 30;
				amount = 8;
			}
			
			else if (name.equalsIgnoreCase("energy")){
				price = 25;
				amount = 8;
			}
			
			else if (name.equalsIgnoreCase("smithOre")){
				price = 50;
				amount = 8;
			}
		}
	}

	/**
	 * gets the resource
	 * @return the resource
	 */
	public Object getResource() {
		return resource;
	}

	/**
	 * gets the resource price
	 * @return resource price
	 */
	public int getPrice() {
		return price;
	}

	/**
	 * gets the amount of the resource
	 * @return resource amount
	 */
	public int getAmount() {
		return amount;
	}

	/**
	 * sets the amount of the resource
	 * @param amount the amount to be set to
	 */
	public void setAmount(int amount) {
		this.amount = amount;
	}
	
	/**
	 * gets the name of the resource
	 * @return name of resource
	 */
	public String getName(){
		return name;
	}
}
